import React,{Fragment,lazy,Suspense} from 'react'
import {Route,Switch,Redirect} from 'react-router-dom'

import Login from './components/Login'
import Loading from './components/Loading'

const Home = lazy(()=>import('./components/Home'))
const RealName = lazy(()=>import('./components/RealName'))

export default function App(){
  return (
    <Fragment>
      <Switch>
        {/* TAG： 需要开启严格模式 不清楚 */}
        <Redirect exact from='/' to='/login'/>
        <Route path='/login' component={Login}></Route>
        <Suspense fallback={<Loading/>}>
          <Route path='/home' component={Home}></Route>
          <Route path='/realname' component={RealName}></Route>
        </Suspense>
      </Switch>
    </Fragment>
  )
}